using LiJ.Pay.WeiXin.Coupon.Mos;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;

namespace LiJ.Pay.WeiXin.Coupon
{
	public class WxPayCouponApi : WxPayBaseApi
	{
		public WxPayCouponApi(WxPayCenterConfig config = null)
			: base(config)
		{
		}

		/// <summary>
		///  发送代金券接口
		/// </summary>
		/// <param name="conpouReq"></param>
		/// <returns></returns>
		public async Task<WxPaySendConpouResp> SendConpouAsync(WxPaySendConpouReq conpouReq)
		{
			string addressUrl = "https://api.mch.weixin.qq.com" + "/mmpaymkttransfers/send_coupon";
			return await base.PostApiAsync(addressUrl, conpouReq.GetDics(), (Func<HttpResponseMessage, Task<WxPaySendConpouResp>>)null, base.GetCertHttpClient(), (Action<SortedDictionary<string, object>>)null);
		}

		/// <summary>
		///  查询代金券批次接口
		/// </summary>
		/// <param name="stockReq"></param>
		/// <returns></returns>
		public async Task<WxPayQueryConpouStockResp> QueryConpouStockAsync(WxPayQueryConpouStockReq stockReq)
		{
			string addressUrl = "https://api.mch.weixin.qq.com" + "/mmpaymkttransfers/query_coupon_stock";
			return await base.PostApiAsync(addressUrl, stockReq.GetDics(), (Func<HttpResponseMessage, Task<WxPayQueryConpouStockResp>>)null, (HttpClient)null, (Action<SortedDictionary<string, object>>)null);
		}

		/// <summary>
		///  查询代金券接口
		/// </summary>
		/// <param name="conpouReq"></param>
		/// <returns></returns>
		public async Task<WxPayQueryConpouStockResp> QueryConpouDetailAsync(WxPayQueryConpouReq conpouReq)
		{
			string addressUrl = "https://api.mch.weixin.qq.com" + "/mmpaymkttransfers/querycouponsinfo";
			return await base.PostApiAsync(addressUrl, conpouReq.GetDics(), (Func<HttpResponseMessage, Task<WxPayQueryConpouStockResp>>)null, (HttpClient)null, (Action<SortedDictionary<string, object>>)null);
		}
	}
}
